import {configureStore} from '@reduxjs/toolkit';
// import user from "@/redux/reducer/user";
// import role from "@/redux/reducer/role";
// import path from "@/redux/reducer/path";
// import menu from "@/redux/reducer/menu";
// import {StatePageType} from "@/redux/index";
// import BaseEntity from "@/type/BaseEntity";

export const store = configureStore({
    reducer: {
        // user,
        // role,
        // path,
        // menu
    }
    // middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(logger).concat(thunk)
});

// eslint-disable-next-line @typescript-eslint/no-unused-vars
// const _state_ = store.getState();

// type StateType = typeof _state_
/**
 * store的keys的key的联合类型,约束ProTable组件的storeName属性
 * 此store名字必须是继承StatePageType
 */
// export type StoreKeys<E extends BaseEntity> = {
//     [K in keyof StateType]: StateType[K] extends StatePageType<E> ? K : never
// }[keyof StateType]

// const x: StoreKeys<SecurityUser> = "user";


// Infer the `RootState` and `AppDispatch` types form the store itself
export type RootState = ReturnType<typeof store.getState>;
// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}
export type AppDispatch = typeof store.dispatch;
export default store;